import { request } from '../request';

/* 验证码登录 */
export function authCodeLogin(params: {
  id?: string;
  loginName: string;
  code: string;
}) {
  return request<Api.TokenInfoVO>({
    url: '/auth/code-login',
    method: 'post',
    data: params,
  });
}

/* 密码登录 */
export function authPasswdLogin(params: { loginName: string; passwd: string }) {
  return request<Api.TokenInfoVO>({
    url: '/auth/passwd-login',
    method: 'post',
    data: params,
  });
}

/* 忘记密码修改密码登录 */
export function authSetPasswdLogin(params: {
  loginName: string;
  code: string;
  passwd: string;
  passwd2: string;
}) {
  return request<Api.TokenInfoVO>({
    url: '/auth/set-passwd-login',
    method: 'post',
    data: params,
  });
}

/* 发送验证码 */
export function authSendCode(params: {
  id?: string;
  loginName: string;
  mark: string;
}) {
  return request<Api.TokenInfoVO>({
    url: '/auth/send-code',
    method: 'post',
    data: params,
  });
}

/* 注销登录 */
export function authLogout() {
  return request<boolean>({
    url: '/auth/logout',
    method: 'get',
  });
}
